package com.twu.biblioteca.commands;

//import com.twu.biblioteca.IOStream.CustomerInputStream;
//import com.twu.biblioteca.IOStream.CustomerOutputStream;

import com.twu.biblioteca.IOStream.Message;
import com.twu.biblioteca.library.Library;

import java.io.IOException;


public class ReserveBooksCommand implements ICommand {

    private int commandId;
    private String bookId;

    public ReserveBooksCommand(int commandId, String bookId) {
        this.commandId = commandId;
        this.bookId = bookId;
    }

    public String toString() {
        return "reserve a book";
    }

    public void execute(Library library) throws IOException {
        if (library.getCurrentCustomer() != null) {
            Message message = library.reserveBooksMessage(this.bookId);
            library.getIo().outputCommand(message);
        } else {
            Message message = library.withoutLoginMessage();
            library.getIo().outputCommand(message);
        }
    }

    public int getCommandId() {
        return commandId;
    }
}
